//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.sgb.net.core;

import android.app.Application;

import com.sgb.net.interceptor.CookieInterceptor;
import com.sgb.net.util.CapitalLog;
import com.sgb.net.util.GetTopActivityUtil;
import com.sgb.net.util.SharedPreferenceUtil;

import okhttp3.Interceptor;

public class NetSDKInit {


    public static NetSDKInit getSingle() {
        return NetSDKInit.Single.instance;
    }

    public NetSDKInit init(Application application, String debugType) {
        SharedPreferenceUtil.init(application);
        GetTopActivityUtil.getInstance().init(application);
        NetConfig.config().baseUrl(debugType.equals("debug") ? "http://api.sgbwl.com/sgb-app/" : (debugType.equals("pre") ? "https://api.jingyingbang.net/sgb-app/" : "http://gateway.shigongbang.com/sgb-app-android/")).addInterceptor(new CookieInterceptor());
        CapitalLog.DEBUG_LOG = debugType.equals("debug");
        return this;
    }

    public NetSDKInit init(Application application, String debugType, boolean isDeBug) {
        SharedPreferenceUtil.init(application);
        GetTopActivityUtil.getInstance().init(application);
        NetConfig.config().baseUrl(debugType.equals("debug") ? "http://api.sgbwl.com/sgb-app/" : (debugType.equals("pre") ? "https://api.jingyingbang.net/sgb-app/" : "http://gateway.shigongbang.com/sgb-app-android/")).addInterceptor(new CookieInterceptor());
        CapitalLog.DEBUG_LOG = isDeBug;
        return this;
    }

    public NetSDKInit addInterceptor(Interceptor interceptor) {
        NetConfig.config().addInterceptor(interceptor);
        return this;
    }

    public NetSDKInit setBaseUrl(String url) {
        NetConfig.config().baseUrl(url);
        return this;
    }

    public NetSDKInit setTimeOut(long timeOut) {
        NetConfig.config().timeOut(timeOut);
        return this;
    }

    private static class Single {
        private static final NetSDKInit instance = new NetSDKInit();

        private Single() {
        }
    }
}
